package org.toonan.rental.chart;

import java.math.BigDecimal;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Shader;
import android.util.Log;
import android.view.View;

public class PieChartView extends View
{
	private Paint arcPaint;
	private String content;
	private float d = 2.0F * this.r;
	private float fromArc;
	private boolean is3D = false;
	private float leftX = 250.0F;
	private float leftY = 100.0F;
	private Paint linePaint;
	private int ply = 15;
	private float r = 120.0F;
	private Paint shadowPaint;
	private float sumArc;
	private Paint textPaint;
	private float value;
	private int whichColor;
	
	public PieChartView(Context paramContext, String paramString, float paramFloat1, float paramFloat2,
			float paramFloat3, int paramInt)
	{
		super(paramContext);
		this.content = paramString;
		this.value = paramFloat1;
		this.fromArc = paramFloat2;
		this.sumArc = paramFloat3;
		this.whichColor = paramInt;
		init();
	}
	
	private int[][] createGradialColors(boolean paramBoolean)
	{
		int[] arrayOfInt1 = new int[5];
		arrayOfInt1[0] = Color.rgb(197, 61, 56);
		arrayOfInt1[1] = Color.rgb(181, 56, 52);
		arrayOfInt1[2] = Color.rgb(171, 53, 48);
		arrayOfInt1[3] = Color.rgb(136, 42, 39);
		arrayOfInt1[4] = Color.rgb(99, 29, 27);
		int[] arrayOfInt2 = new int[5];
		arrayOfInt2[0] = Color.rgb(255, 100, 100);
		arrayOfInt2[1] = Color.rgb(230, 100, 100);
		arrayOfInt2[2] = Color.rgb(200, 100, 100);
		arrayOfInt2[3] = Color.rgb(180, 100, 100);
		arrayOfInt2[4] = Color.rgb(160, 100, 100);
		int[] arrayOfInt3 = new int[5];
		arrayOfInt3[0] = Color.rgb(124, 167, 0);
		arrayOfInt3[1] = Color.rgb(111, 149, 0);
		arrayOfInt3[2] = Color.rgb(100, 133, 0);
		arrayOfInt3[3] = Color.rgb(79, 105, 0);
		arrayOfInt3[4] = Color.rgb(60, 79, 0);
		int[] arrayOfInt4 = new int[5];
		arrayOfInt4[0] = Color.rgb(100, 255, 100);
		arrayOfInt4[1] = Color.rgb(100, 230, 100);
		arrayOfInt4[2] = Color.rgb(100, 200, 100);
		arrayOfInt4[3] = Color.rgb(100, 180, 100);
		arrayOfInt4[4] = Color.rgb(100, 160, 100);
		int[] arrayOfInt5 = new int[5];
		arrayOfInt5[0] = Color.rgb(55, 175, 208);
		arrayOfInt5[1] = Color.rgb(49, 155, 186);
		arrayOfInt5[2] = Color.rgb(44, 142, 169);
		arrayOfInt5[3] = Color.rgb(36, 112, 134);
		arrayOfInt5[4] = Color.rgb(26, 85, 100);
		int[] arrayOfInt6 = new int[5];
		arrayOfInt6[0] = Color.rgb(100, 100, 255);
		arrayOfInt6[1] = Color.rgb(100, 100, 230);
		arrayOfInt6[2] = Color.rgb(100, 100, 200);
		arrayOfInt6[3] = Color.rgb(100, 100, 180);
		arrayOfInt6[4] = Color.rgb(100, 100, 160);
		int[] arrayOfInt7 = new int[5];
		arrayOfInt7[0] = Color.rgb(196, 100, 196);
		arrayOfInt7[1] = Color.rgb(180, 100, 180);
		arrayOfInt7[2] = Color.rgb(160, 100, 160);
		arrayOfInt7[3] = Color.rgb(140, 100, 140);
		arrayOfInt7[4] = Color.rgb(120, 100, 120);
		int[] arrayOfInt8 = new int[5];
		arrayOfInt8[0] = Color.rgb(122, 88, 163);
		arrayOfInt8[1] = Color.rgb(108, 78, 144);
		arrayOfInt8[2] = Color.rgb(99, 71, 134);
		arrayOfInt8[3] = Color.rgb(81, 57, 107);
		arrayOfInt8[4] = Color.rgb(57, 40, 75);
		int[] arrayOfInt9 = new int[5];
		arrayOfInt9[0] = Color.rgb(234, 141, 41);
		arrayOfInt9[1] = Color.rgb(213, 128, 38);
		arrayOfInt9[2] = Color.rgb(186, 113, 33);
		arrayOfInt9[3] = Color.rgb(150, 91, 27);
		arrayOfInt9[4] = Color.rgb(111, 68, 20);
		int[] arrayOfInt10 = new int[5];
		arrayOfInt10[0] = Color.rgb(255, 255, 100);
		arrayOfInt10[1] = Color.rgb(230, 230, 100);
		arrayOfInt10[2] = Color.rgb(200, 200, 100);
		arrayOfInt10[3] = Color.rgb(180, 180, 100);
		arrayOfInt10[4] = Color.rgb(160, 160, 100);
		int[] arrayOfInt11 = new int[5];
		arrayOfInt11[0] = Color.rgb(159, 196, 226);
		arrayOfInt11[1] = Color.rgb(142, 176, 202);
		arrayOfInt11[2] = Color.rgb(129, 158, 183);
		arrayOfInt11[3] = Color.rgb(112, 137, 158);
		arrayOfInt11[4] = Color.rgb(78, 96, 110);
		int[] arrayOfInt12 = new int[5];
		arrayOfInt12[0] = Color.rgb(179, 216, 246);
		arrayOfInt12[1] = Color.rgb(162, 196, 222);
		arrayOfInt12[2] = Color.rgb(149, 178, 203);
		arrayOfInt12[3] = Color.rgb(132, 157, 178);
		arrayOfInt12[4] = Color.rgb(98, 116, 130);
		int[] arrayOfInt13 = new int[5];
		arrayOfInt13[0] = Color.rgb(0, 127, 127);
		arrayOfInt13[1] = Color.rgb(0, 112, 112);
		arrayOfInt13[2] = Color.rgb(0, 103, 103);
		arrayOfInt13[3] = Color.rgb(0, 80, 80);
		arrayOfInt13[4] = Color.rgb(0, 46, 46);
		int[] arrayOfInt14 = new int[5];
		arrayOfInt14[0] = Color.rgb(0, 147, 147);
		arrayOfInt14[1] = Color.rgb(0, 132, 132);
		arrayOfInt14[2] = Color.rgb(0, 123, 123);
		arrayOfInt14[3] = Color.rgb(0, 100, 100);
		arrayOfInt14[4] = Color.rgb(0, 66, 66);
		int[][] arrayOfInt15 = { arrayOfInt1, arrayOfInt3, arrayOfInt5, arrayOfInt8, arrayOfInt9,
				arrayOfInt11, arrayOfInt13 };
		int[][] arrayOfInt16 = { arrayOfInt2, arrayOfInt4, arrayOfInt6, arrayOfInt7, arrayOfInt10,
				arrayOfInt12, arrayOfInt14 };
		if (this.is3D)
			;
		for (int[][] arrayOfInt17 = arrayOfInt16;; arrayOfInt17 = arrayOfInt15)
			return arrayOfInt17;
	}
	
	private void init()
	{
		this.arcPaint = new Paint();
		this.shadowPaint = new Paint();
		this.linePaint = new Paint();
		this.textPaint = new Paint();
		this.arcPaint.setAntiAlias(true);
		this.shadowPaint.setAntiAlias(true);
		this.linePaint.setAntiAlias(true);
		this.textPaint.setAntiAlias(true);
		setPaintColor(this.whichColor);
		this.arcPaint.setStrokeWidth(3.0F);
		this.shadowPaint.setStrokeWidth(1.0F);
		this.linePaint.setStrokeWidth(1.0F);
		this.textPaint.setTextSize(20.0F);
		this.arcPaint.setStyle(Paint.Style.FILL);
		this.shadowPaint.setStyle(Paint.Style.FILL);
	}
	
	private void setPaintColor(int paramInt)
	{
		int[][] arrayOfInt1 = createGradialColors(false);
		int[][] arrayOfInt2 = createGradialColors(true);
		float[] arrayOfFloat = { 0.0F, 0.4F, 0.8F, 0.9F, 1.0F };
		this.arcPaint.setShader(new RadialGradient(this.leftX + this.r, this.leftY + this.r, this.r,
				arrayOfInt1[paramInt], arrayOfFloat, Shader.TileMode.MIRROR));
		this.shadowPaint.setShader(new RadialGradient(this.leftX + this.r, this.leftY + this.r, this.r,
				arrayOfInt2[paramInt], arrayOfFloat, Shader.TileMode.MIRROR));
		this.linePaint.setColor(-16777216);
		this.textPaint.setColor(-16777216);
	}
	
	public int getColor(int paramInt)
	{
		return createGradialColors(false)[paramInt][0];
	}
	
	protected void onDraw(Canvas paramCanvas)
	{
		super.onDraw(paramCanvas);
		int i;
		double d1 = 0D;
		String str;
		double d3;
		double d4;
		double d5 = 0D;
		double d6 = 0D;
		if (this.is3D)
		{
			i = 1;
			if (i >= this.ply - 5)
			{
				paramCanvas.drawArc(new RectF(this.leftX, this.leftY, this.leftX + this.d, this.leftY
						+ this.d), this.fromArc, this.sumArc, true, this.arcPaint);
				d1 = this.fromArc + this.sumArc / 2.0F;
				str = new BigDecimal(100.0F * (this.sumArc / 360.0F)).setScale(1, 4).floatValue() + "%";
				double d2 = Math.toRadians(d1);
				d3 = 0.0D;
				d4 = 0.0D;
				d5 = this.r * Math.cos(d2) + this.r + this.leftX;
				d6 = this.r * Math.sin(d2) + this.r + this.leftY;
				d3 = d5 + 30.0D;
				d4 = d6 + 30.0D;
				paramCanvas.drawText(str, (float) d3, (float) d4, this.textPaint);
				paramCanvas.drawText(this.content + " " + this.value + "万", (float) d3, (float) (d4 + 30.0D),
						this.textPaint);
				Log.i("line", d5 + "\t" + d6 + "\t" + "\t" + d1 + " " + "1");
				if ((d1 <= 0.0D) || (d1 >= 90.0D))
					paramCanvas.drawLine((float) d5, (float) d6, (float) d3, (float) d4, this.linePaint);
				paramCanvas.drawArc(new RectF(this.leftX, this.leftY + i, this.leftX + this.d, this.leftY
						+ this.d + i), this.fromArc, this.sumArc, true, this.shadowPaint);
				i++;
				if ((d1 > 90.0D) && (d1 < 180.0D))
				{
					d3 = d5 - 30.0D;
					d4 = d6 + 30.0D;
					paramCanvas.drawText(str, (float) d3 - 50.0F, (float) d4, this.textPaint);
					paramCanvas.drawText(this.content + " " + this.value + "万", (float) d3 - 50.0F,
							(float) (d4 + 30.0D), this.textPaint);
					Log.i("line", d5 + "\t" + d6 + "\t" + "\t" + d1 + " " + "2");
				}
				if ((d1 > 180.0D) && (d1 < 270.0D))
				{
					d3 = d5 - 30.0D;
					d4 = d6 - 30.0D;
					paramCanvas.drawText(str, (float) d3 - 50.0F, (float) d4, this.textPaint);
					paramCanvas.drawText(this.content + " " + this.value + "万", (float) d3 - 50.0F,
							(float) (d4 - 30.0D), this.textPaint);
					Log.i("line", d5 + "\t" + d6 + "\t" + "\t" + d1 + " " + "3");
				}
				if ((d1 > 270.0D) && (d1 < 360.0D))
				{
					d3 = d5 + 30.0D;
					d4 = d6 - 30.0D;
					paramCanvas.drawText(str, (float) d3, (float) d4, this.textPaint);
					paramCanvas.drawText(this.content + " " + this.value + "万", (float) d3,
							(float) (d4 - 30.0D), this.textPaint);
					Log.i("line", d5 + "\t" + d6 + "\t" + "\t" + d1 + " " + "4");
				}
				if ((d1 == 90.0D) || (d1 == 180.0D))
					paramCanvas.drawArc(new RectF(this.leftX, this.leftY + this.ply, this.leftX + this.d,
							this.leftY + this.d + this.ply), this.fromArc, this.sumArc, true,
							this.shadowPaint);
			}
		}
		
	}
	
	public void set3D(boolean paramBoolean)
	{
		this.is3D = paramBoolean;
	}
}

/*
 * Location: E:\org.toonan.rental.chart.1353877036934_dex2jar.jar Qualified Name:
 * org.toonan.rental.chart.PieChartView JD-Core Version: 0.6.0
 */